package com.fanghaoran.view.user;

import javax.swing.*;
import java.awt.*;

/**
 * @Author: win11
 * @Date: 2023/03/16/0:23
 * @Description: 写一个可以带背景图片的panel
 */
public class BackGroundPanel extends JPanel {
    /**
     * 声明图片变量
     */
    private final Image backIcon;
    public BackGroundPanel(Image backIcon){
        this.backIcon=backIcon;
    }
    /**
     * 绘制背景
     */
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(backIcon,0,0,this.getWidth(),this.getHeight(),null);
    }
}
